'use strict';

const BaseController = require('../base');

class BalanceRecordController extends BaseController {
  static get serviceName() {
    return 'business.balanceRecord';
  }
  async todayTotal() {
      const { user_id } = this.ctx.query;
      const result = await this.service.getTodayWithdrawTotal(user_id);
      this.ctx.success({ total: result });
  }

  // 充值
  async createRecharge() {
    const result = await this.service.createRecharge(this.ctx.request.body);
    this.ctx.success(result);
  }

  /**
   * 提现
   */
  async withdraw() {
    const result = await this.service.withdraw(this.ctx.request.body);
    this.ctx.success(result);
  }

  async retryWithdraw() {
    const result = await this.service.retryWithdraw(this.ctx.request.body);
    this.ctx.success(result);
  }
}

module.exports = BalanceRecordController;
